package com.example.demo.service;

import com.example.demo.common.ResultAjax;
import com.example.demo.common.SessionUtils;
import com.example.demo.dao.ArticleMapper;
import com.example.demo.model.Articleinfo;
import com.example.demo.model.Userinfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Service
public class ArticleService {

    //将articleMapper接口注入到该类中
    @Autowired
    private ArticleMapper articleMapper;

    //通过 uid 获取文章
    public List<Articleinfo> getListByUid(int uid) {
        return articleMapper.getListByUid(uid);
    }

    // 删除文章操作
    public int del(Integer aid,int uid) {
        return articleMapper.del(aid,uid);
    }

    // 新增文章
    public int add(Articleinfo articleinfo) {
        return articleMapper.add(articleinfo);
    }
}
